package co.com.services.estudiantegrupo;

import javax.naming.NamingException;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import co.com.smart.maestro.infraestructure.dto.EstudgrupoDTO;
import co.com.smart.session.DelegateContextEJB;

@Path("/SmartEstudianteGrupoServices")
public class EstudianteGrupoServices {

			@GET
			@Path("/getAllEstudianteGrupo")	
			@Produces(MediaType.APPLICATION_JSON)
			public Response getEstudianteGrupo() throws NamingException {
				return Response.ok(DelegateContextEJB.getEstudianteGrupoBeanLocal().consultarAllEstudianteGrupo())
				.header("Access-Control-Allow-Origin", "*")
				.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
				.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
			}

			@POST
			@Path("/getEstudianteGrupoId")	
			@Produces(MediaType.APPLICATION_JSON)
			public Response getEstudianteGrupoId(EstudgrupoDTO json) throws NamingException {
				return Response.ok(DelegateContextEJB.getEstudianteGrupoBeanLocal().consultarEstudianteGrupoId(json))
				.header("Access-Control-Allow-Origin", "*")
				.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
				.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
			}

			@PUT
			@Path("/setEstudianteGrupo")
			@Consumes(MediaType.APPLICATION_JSON)
			@Produces(MediaType.APPLICATION_JSON)
			public Response setEstudianteGrupo( EstudgrupoDTO json){ 
				return Response.ok(DelegateContextEJB.getEstudianteGrupoBeanLocal().insertarEstudianteGrupo(json))
						.header("Access-Control-Allow-Origin", "*")
						.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
						.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With")
						.build();
			}

			@PUT
			@Path("/editEstudianteGrupo")
			@Consumes(MediaType.APPLICATION_JSON)
			@Produces(MediaType.APPLICATION_JSON)
			public Response setEditEstudianteGrupo(EstudgrupoDTO json){ 
				return Response.ok(DelegateContextEJB.getEstudianteGrupoBeanLocal().editEstudianteGrupo(json))
				.header("Access-Control-Allow-Origin", "*")
				.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
				.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
			}

			@PUT
			@Path("/removeEstudianteGrupo")
			@Consumes(MediaType.APPLICATION_JSON)
			@Produces(MediaType.APPLICATION_JSON)
			public Response setRemoveEstudianteGrupo(EstudgrupoDTO json){ 
				return Response.ok(DelegateContextEJB.getEstudianteGrupoBeanLocal().removeEstudianteGrupo(json, true))
						.header("Access-Control-Allow-Origin", "*")
						.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
						.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
			}


}
